package com.jacobson.huobi.di.modules

import com.jacobson.core.di.annotation.ActivityScope
import com.jacobson.core.widget.storage.GlobalStorage
import com.jacobson.huobi.Constants
import com.jacobson.huobi.components.toptab.TabsData
import com.jacobson.huobi.entities.AlarmInfo
import com.jacobson.huobi.entities.SymbolInfo
import com.jacobson.huobi.mvp.contract.SymbolContract
import com.jacobson.huobi.mvp.model.SymbolModel
import com.jacobson.huobi.mvp.presenter.SymbolPresenter
import dagger.Module
import dagger.Provides

@Module
class SymbolFragmentModule(
    private val view: SymbolContract.View
) {
    @Provides
    @ActivityScope
    fun provideView() = view

    @Provides
    @ActivityScope
    fun providePresenter(presenter: SymbolPresenter): SymbolContract.Presenter = presenter

    @Provides
    @ActivityScope
    fun provideModel(model: SymbolModel): SymbolContract.Model = model

    @Provides
    @ActivityScope
    fun provideTabsData(): TabsData {
        val tabsData = TabsData()
        tabsData.add(0, "自选")
        tabsData.add(1, "主流")
        tabsData.add(2, "中小")
        tabsData.add(3, "山寨")
        tabsData.add(4, "分析")
        return tabsData
    }

    @Provides
    @ActivityScope
    @Suppress("UNCHECKED_CAST")
    fun provideSymbolInfoList(): MutableList<SymbolInfo> =
        GlobalStorage.get(Constants.KEY_SYMBOL_LIST) as MutableList<SymbolInfo>
}